package com.dtflys.forest.example.amap;

import cn.hutool.extra.spring.SpringUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Import(SpringUtil.class)
@EnableSwagger2
@SpringBootApplication
public class ExampleAmapApplication {

    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.dtflys.forest.example.amap.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Forest对接高德地图API")
                .contact(new Contact("公子骏", "https://gitee.com/dt_flys", "dt_flys@hotmail.com"))
                .version("1.0")
                .description("Forest对接高德地图API")
                .build();
    }


    public static void main(String[] args) {
        SpringApplication.run(ExampleAmapApplication.class, args);
    }

}
